<?php
class Lang
{
	public static function sys($key)
	{
		$res = '';
		$langs = $GLOBALS['sys_' . $GLOBALS['sys_run']['default_language']];
		$res = self::get($langs, $key);
		return $res;
	}
	
	public static function app($key)
	{
		$res = '';
		$langs = $GLOBALS[APP_NAME . '_' . $GLOBALS[APP_NAME . '_run']['default_language']];
		$res = self::get($langs, $key);
		return $res;
	}
	
	public static function get($langs, $key)
	{
		$res = '';
		if (is_array($key)) {
			foreach ($key as $item) {
				$res .= isset($langs[$item]) ? $langs[$item] : $key;
			}
		} else {
			$res = isset($langs[$key]) ? $langs[$key] : $key;
		}
		return $res;
	}
}